package com.ipharma.gui;

import javax.swing.JPanel;

import com.ipharma.McdError;
import com.ipharma.application.services.Dispenser;
import com.ipharma.assignments.Assignment;
import com.ipharma.config.Session;
import com.ipharma.dto.Product;

/**
 * A Swing-based top level window class.
 * <P>
 * 
 * @author JorgE.H
 */
public class GUIOperation extends JPanel {

   /**
    * Attributes
    */
   Dispenser theDispenser;
   Assignment assign;
   Session theSess;
   GUIWindow myContainer;

   /**
    * Constructs a new instance.
    */
   public GUIOperation(GUIWindow pContainer) {

      super();
      try {
         myContainer = pContainer;
		 theDispenser = new Dispenser( pContainer.theSess );
         theSess = pContainer.theSess;
         // obtengo el nro. de dispenser de session
         /*Config config = (Config) theSess.get(McdPrs.CONFIG);
         dispenserId = config.getDispenser();*/
         
         jbInit();
      } catch (Exception e) {
         McdError.add(e);
      }
   }

   /**
    * Initializes the state of this instance.
    */
   private void jbInit() throws Exception {

   }

   /**
    * Starts execution
    */
   public void start() {

   }

   /**
    * Selects a product into transaction
    * 
    * @param pProd
    *           Button instance pushed
    * @return int quantity selected
    */
   public int selectProduct(Product pProd) {

      return 0;
   }

   /**
    * Selects a product through external device
    * 
    * @param pCode
    *           description enter via Barcode reader
    * @return true if code exists, false otherwise
    */
   public boolean externalSelection(String pCode) {

      return false;
   }

   /**
    * Returns the product matching pCode
    * 
    * @param pCode
    *           product code
    * @return the Product object
    */
   public Product getSelectedProduct(String pCode) {

      return null;
   }

   /**
    * Returns the type of operation
    * 
    * @return type of operation
    */
   public int getType() {

      return 0;
   }

}